package LookAndFeel;

import java.awt.Color;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Insets;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;
 
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.SwingConstants;
 
 
public class Bouton extends JButton{
 
	private static final long serialVersionUID = 1L;
    private Image img;
         
    public Bouton(String image){
    	super("");
    	try {
       	 img = ImageIO.read(new File(image));
    	}catch (IOException e) {
            e.printStackTrace();
        } 
    	this.setIcon(new ImageIcon(img));
    	this.setContentAreaFilled(false);
    	this.setMargin(new Insets(0, 0, 0, 0));
    	this.setBorderPainted(true);    	 
    }
    
    
    
    public Bouton(String image, String titre){
    	super("<html><div color='yellow'><b>"+titre+"</b></div></html>");
    	try {
    		img = ImageIO.read(new File(image));
    	}catch (IOException e) {
            e.printStackTrace();
        } 
    	this.setIcon(new ImageIcon(img));
    	this.setContentAreaFilled(false);
    	this.setMargin(new Insets(0, 0, 0, 0));
    	this.setBorderPainted(true);  
    	this.setVerticalTextPosition(SwingConstants.CENTER);
    	this.setHorizontalTextPosition(SwingConstants.CENTER);
    }
    
    
}